package droid.frame.view.xlist;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import droid.frame.libcore.R;

@SuppressLint("ViewConstructor")
public class RotateLoadingLayout extends FrameLayout {

	// final int ROTATION_ANIMATION_DURATION = 1200;
	//
	// private final Animation mRotateAnimation;
	// private final Matrix mHeaderImageMatrix;
	//
	// private final Interpolator ANIMATION_INTERPOLATOR = new LinearInterpolator();

	protected ImageView mHeaderImage;

	public RotateLoadingLayout(Context context) {
		super(context);
		LayoutInflater.from(context).inflate(R.layout.pull_to_refresh, this);
		mHeaderImage = (ImageView) findViewById(R.id.pull_to_refresh_image);
		// 隐藏footer
		findViewById(R.id.pull_footer_layout).setVisibility(View.GONE);
		// Drawable imageDrawable = getResources().getDrawable(R.drawable.default_ptr_rotate);
		// mHeaderImage.setImageDrawable(imageDrawable);
		// //
		// mHeaderImage.setScaleType(ScaleType.MATRIX);
		// mHeaderImageMatrix = new Matrix();
		// mHeaderImage.setImageMatrix(mHeaderImageMatrix);
		//
		// mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
		// mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
		// mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
		// mRotateAnimation.setRepeatCount(Animation.INFINITE);
		// mRotateAnimation.setRepeatMode(Animation.RESTART);
	}

	public void startAnimation() {
		// mHeaderImage.clearAnimation();// 先停止
		// mHeaderImage.startAnimation(mRotateAnimation);
	}

	public void stopAnimation() {
		// mHeaderImage.clearAnimation();
		// if (null != mHeaderImageMatrix) {
		// mHeaderImageMatrix.reset();
		// mHeaderImage.setImageMatrix(mHeaderImageMatrix);
		// }
	}

}
